\hypertarget{a00093}{}\section{E\+:/knet-\/git/knet/knet/rpc.c 文件参考}
\label{a00093}\index{E\+:/knet-\/git/knet/knet/rpc.\+c@{E\+:/knet-\/git/knet/knet/rpc.\+c}}
{\ttfamily \#include \char`\"{}rpc\+\_\+api.\+h\char`\"{}}\\*
{\ttfamily \#include \char`\"{}hash.\+h\char`\"{}}\\*
{\ttfamily \#include \char`\"{}channel\+\_\+ref.\+h\char`\"{}}\\*
{\ttfamily \#include \char`\"{}stream.\+h\char`\"{}}\\*
{\ttfamily \#include \char`\"{}rpc\+\_\+object.\+h\char`\"{}}\\*
\subsection*{结构体}
\begin{DoxyCompactItemize}
\item 
struct \hyperlink{a00042}{krpc\+\_\+header\+\_\+t}
\item 
struct \hyperlink{a00022}{\+\_\+krpc\+\_\+t}
\end{DoxyCompactItemize}
\subsection*{类型定义}
\begin{DoxyCompactItemize}
\item 
typedef struct \hyperlink{a00042}{krpc\+\_\+header\+\_\+t} \hyperlink{a00093_aaadecef3a6bd120b41aee1916b5854d0_aaadecef3a6bd120b41aee1916b5854d0}{krpc\+\_\+header\+\_\+t}
\item 
typedef enum \hyperlink{a00093_a4045ccaf4758dcf838a88a58c73e462b_a4045ccaf4758dcf838a88a58c73e462b}{\+\_\+krpc\+\_\+call\+\_\+type\+\_\+e} \hyperlink{a00093_aa7109e23eab2e74945868adf0b60132b_aa7109e23eab2e74945868adf0b60132b}{krpc\+\_\+call\+\_\+type\+\_\+e}
\end{DoxyCompactItemize}
\subsection*{枚举}
\begin{DoxyCompactItemize}
\item 
enum \hyperlink{a00093_a4045ccaf4758dcf838a88a58c73e462b_a4045ccaf4758dcf838a88a58c73e462b}{\+\_\+krpc\+\_\+call\+\_\+type\+\_\+e} \{ \hyperlink{a00093_a4045ccaf4758dcf838a88a58c73e462b_a4045ccaf4758dcf838a88a58c73e462ba831d2f31c2f7281a9b54c6816df54c61}{krpc\+\_\+call\+\_\+type\+\_\+result} = 1, 
\hyperlink{a00093_a4045ccaf4758dcf838a88a58c73e462b_a4045ccaf4758dcf838a88a58c73e462baff220c476768b4bf6b308fa257e12c4b}{krpc\+\_\+call\+\_\+type\+\_\+call} = 2
 \}
\end{DoxyCompactItemize}
\subsection*{函数}
\begin{DoxyCompactItemize}
\item 
int \hyperlink{a00093_a81438b66394a3d6bf42c1971fefeb67c_a81438b66394a3d6bf42c1971fefeb67c}{\+\_\+krpc\+\_\+call\+\_\+encrypt} (\hyperlink{a00056_a1e414ac6f6de24462ccf81e10f63428d_a1e414ac6f6de24462ccf81e10f63428d}{krpc\+\_\+t} $\ast$rpc, \hyperlink{a00056_acc208c4c40c875eebbfef88f00fffacf_acc208c4c40c875eebbfef88f00fffacf}{kstream\+\_\+t} $\ast$stream, uint16\+\_\+t rpcid, \hyperlink{a00056_a9c07dfc8c3b965f75b09f82fdb1bbb1e_a9c07dfc8c3b965f75b09f82fdb1bbb1e}{krpc\+\_\+object\+\_\+t} $\ast$o)
\item 
int \hyperlink{a00093_a8e2ea426099ea032432a9aeb24088cf0_a8e2ea426099ea032432a9aeb24088cf0}{\+\_\+krpc\+\_\+call} (\hyperlink{a00056_a1e414ac6f6de24462ccf81e10f63428d_a1e414ac6f6de24462ccf81e10f63428d}{krpc\+\_\+t} $\ast$rpc, \hyperlink{a00056_acc208c4c40c875eebbfef88f00fffacf_acc208c4c40c875eebbfef88f00fffacf}{kstream\+\_\+t} $\ast$stream, uint16\+\_\+t rpcid, \hyperlink{a00056_a9c07dfc8c3b965f75b09f82fdb1bbb1e_a9c07dfc8c3b965f75b09f82fdb1bbb1e}{krpc\+\_\+object\+\_\+t} $\ast$o)
\item 
\hyperlink{a00056_a1e414ac6f6de24462ccf81e10f63428d_a1e414ac6f6de24462ccf81e10f63428d}{krpc\+\_\+t} $\ast$ \hyperlink{a00093_a5d55f838d222f44965d99eac9a0381c1_a5d55f838d222f44965d99eac9a0381c1}{krpc\+\_\+create} ()
\begin{DoxyCompactList}\small\item\em R\+P\+C框架提供了一套底层\+R\+P\+C序列化及反序列化的基础，开发者不应该直接调用这些\+A\+P\+I，应使用代码生成工具 提供的代码框架来进行\+R\+P\+C操作，生成的代码框架屏蔽了所有烦人的细节，使用起来也会比直接调用这些\+A\+P\+I更 方便. \end{DoxyCompactList}\item 
void \hyperlink{a00093_ab07c8ccf1abc99b85f455a2f4280ac76_ab07c8ccf1abc99b85f455a2f4280ac76}{krpc\+\_\+destroy} (\hyperlink{a00056_a1e414ac6f6de24462ccf81e10f63428d_a1e414ac6f6de24462ccf81e10f63428d}{krpc\+\_\+t} $\ast$rpc)
\begin{DoxyCompactList}\small\item\em 销毁\+R\+P\+C \end{DoxyCompactList}\item 
int \hyperlink{a00093_aa12a9874d2b0308994c3fa651cdbbd61_aa12a9874d2b0308994c3fa651cdbbd61}{krpc\+\_\+add\+\_\+cb} (\hyperlink{a00056_a1e414ac6f6de24462ccf81e10f63428d_a1e414ac6f6de24462ccf81e10f63428d}{krpc\+\_\+t} $\ast$rpc, uint16\+\_\+t rpcid, \hyperlink{a00056_a06bb708c1b97445d3a5d0c1b32ad2ab6_a06bb708c1b97445d3a5d0c1b32ad2ab6}{krpc\+\_\+cb\+\_\+t} cb)
\begin{DoxyCompactList}\small\item\em 注册\+R\+P\+C调用回调函数 \end{DoxyCompactList}\item 
int \hyperlink{a00093_a76529ccab5c6f0ada79cac791e299ef9_a76529ccab5c6f0ada79cac791e299ef9}{krpc\+\_\+del\+\_\+cb} (\hyperlink{a00056_a1e414ac6f6de24462ccf81e10f63428d_a1e414ac6f6de24462ccf81e10f63428d}{krpc\+\_\+t} $\ast$rpc, uint16\+\_\+t rpcid)
\begin{DoxyCompactList}\small\item\em 删除注册过的\+R\+P\+C调用回调函数 \end{DoxyCompactList}\item 
\hyperlink{a00056_a06bb708c1b97445d3a5d0c1b32ad2ab6_a06bb708c1b97445d3a5d0c1b32ad2ab6}{krpc\+\_\+cb\+\_\+t} \hyperlink{a00093_a7841a0b4c828efcb607a51bbdd9c9ab1_a7841a0b4c828efcb607a51bbdd9c9ab1}{krpc\+\_\+get\+\_\+cb} (\hyperlink{a00056_a1e414ac6f6de24462ccf81e10f63428d_a1e414ac6f6de24462ccf81e10f63428d}{krpc\+\_\+t} $\ast$rpc, uint16\+\_\+t rpcid)
\begin{DoxyCompactList}\small\item\em 取得注册过的\+R\+P\+C调用回调函数 \end{DoxyCompactList}\item 
int \hyperlink{a00093_a87f076f27729e0d352ffd12173ab13ab_a87f076f27729e0d352ffd12173ab13ab}{\+\_\+krpc\+\_\+proc\+\_\+decrypt} (\hyperlink{a00056_a1e414ac6f6de24462ccf81e10f63428d_a1e414ac6f6de24462ccf81e10f63428d}{krpc\+\_\+t} $\ast$rpc, \hyperlink{a00056_acc208c4c40c875eebbfef88f00fffacf_acc208c4c40c875eebbfef88f00fffacf}{kstream\+\_\+t} $\ast$stream)
\item 
int \hyperlink{a00093_ae905b4f6864964a0080435a81748c3f1_ae905b4f6864964a0080435a81748c3f1}{\+\_\+krpc\+\_\+proc} (\hyperlink{a00056_a1e414ac6f6de24462ccf81e10f63428d_a1e414ac6f6de24462ccf81e10f63428d}{krpc\+\_\+t} $\ast$rpc, \hyperlink{a00056_acc208c4c40c875eebbfef88f00fffacf_acc208c4c40c875eebbfef88f00fffacf}{kstream\+\_\+t} $\ast$stream)
\item 
int \hyperlink{a00093_ac583f7d7c3e3ecb9954530e8d0f6f5f1_ac583f7d7c3e3ecb9954530e8d0f6f5f1}{krpc\+\_\+proc} (\hyperlink{a00056_a1e414ac6f6de24462ccf81e10f63428d_a1e414ac6f6de24462ccf81e10f63428d}{krpc\+\_\+t} $\ast$rpc, \hyperlink{a00056_acc208c4c40c875eebbfef88f00fffacf_acc208c4c40c875eebbfef88f00fffacf}{kstream\+\_\+t} $\ast$stream)
\begin{DoxyCompactList}\small\item\em 处理\+R\+P\+C调用，从数据流反序列化\+R\+P\+C调用，并调用回调函数 \end{DoxyCompactList}\item 
int \hyperlink{a00093_a063313e66bd9a479b4d0a6295a5e665b_a063313e66bd9a479b4d0a6295a5e665b}{krpc\+\_\+call} (\hyperlink{a00056_a1e414ac6f6de24462ccf81e10f63428d_a1e414ac6f6de24462ccf81e10f63428d}{krpc\+\_\+t} $\ast$rpc, \hyperlink{a00056_acc208c4c40c875eebbfef88f00fffacf_acc208c4c40c875eebbfef88f00fffacf}{kstream\+\_\+t} $\ast$stream, uint16\+\_\+t rpcid, \hyperlink{a00056_a9c07dfc8c3b965f75b09f82fdb1bbb1e_a9c07dfc8c3b965f75b09f82fdb1bbb1e}{krpc\+\_\+object\+\_\+t} $\ast$o)
\begin{DoxyCompactList}\small\item\em 发起\+R\+P\+C调用 \end{DoxyCompactList}\item 
int \hyperlink{a00093_a5317bb571cb4d94bc56b83989c1b10c2_a5317bb571cb4d94bc56b83989c1b10c2}{krpc\+\_\+set\+\_\+encrypt\+\_\+cb} (\hyperlink{a00056_a1e414ac6f6de24462ccf81e10f63428d_a1e414ac6f6de24462ccf81e10f63428d}{krpc\+\_\+t} $\ast$rpc, \hyperlink{a00056_ae41a67cc07f8dff897ca978e03b1f2d7_ae41a67cc07f8dff897ca978e03b1f2d7}{krpc\+\_\+encrypt\+\_\+t} func)
\begin{DoxyCompactList}\small\item\em 设置签名加密回调 \end{DoxyCompactList}\item 
int \hyperlink{a00093_aa75ec66092e77639ca2cf2b5ad04c5db_aa75ec66092e77639ca2cf2b5ad04c5db}{krpc\+\_\+set\+\_\+decrypt\+\_\+cb} (\hyperlink{a00056_a1e414ac6f6de24462ccf81e10f63428d_a1e414ac6f6de24462ccf81e10f63428d}{krpc\+\_\+t} $\ast$rpc, \hyperlink{a00056_a5cf750f151c90f0589f68fe8c4421f1d_a5cf750f151c90f0589f68fe8c4421f1d}{krpc\+\_\+decrypt\+\_\+t} func)
\begin{DoxyCompactList}\small\item\em 设置签名解密回调 \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{类型定义说明}
\hypertarget{a00093_aa7109e23eab2e74945868adf0b60132b_aa7109e23eab2e74945868adf0b60132b}{}\index{rpc.\+c@{rpc.\+c}!krpc\+\_\+call\+\_\+type\+\_\+e@{krpc\+\_\+call\+\_\+type\+\_\+e}}
\index{krpc\+\_\+call\+\_\+type\+\_\+e@{krpc\+\_\+call\+\_\+type\+\_\+e}!rpc.\+c@{rpc.\+c}}
\subsubsection[{krpc\+\_\+call\+\_\+type\+\_\+e}]{\setlength{\rightskip}{0pt plus 5cm}typedef enum {\bf \+\_\+krpc\+\_\+call\+\_\+type\+\_\+e}  {\bf krpc\+\_\+call\+\_\+type\+\_\+e}}\label{a00093_aa7109e23eab2e74945868adf0b60132b_aa7109e23eab2e74945868adf0b60132b}
\hypertarget{a00093_aaadecef3a6bd120b41aee1916b5854d0_aaadecef3a6bd120b41aee1916b5854d0}{}\index{rpc.\+c@{rpc.\+c}!krpc\+\_\+header\+\_\+t@{krpc\+\_\+header\+\_\+t}}
\index{krpc\+\_\+header\+\_\+t@{krpc\+\_\+header\+\_\+t}!rpc.\+c@{rpc.\+c}}
\subsubsection[{krpc\+\_\+header\+\_\+t}]{\setlength{\rightskip}{0pt plus 5cm}typedef struct {\bf krpc\+\_\+header\+\_\+t}  {\bf krpc\+\_\+header\+\_\+t}}\label{a00093_aaadecef3a6bd120b41aee1916b5854d0_aaadecef3a6bd120b41aee1916b5854d0}


\subsection{枚举类型说明}
\hypertarget{a00093_a4045ccaf4758dcf838a88a58c73e462b_a4045ccaf4758dcf838a88a58c73e462b}{}\index{rpc.\+c@{rpc.\+c}!\+\_\+krpc\+\_\+call\+\_\+type\+\_\+e@{\+\_\+krpc\+\_\+call\+\_\+type\+\_\+e}}
\index{\+\_\+krpc\+\_\+call\+\_\+type\+\_\+e@{\+\_\+krpc\+\_\+call\+\_\+type\+\_\+e}!rpc.\+c@{rpc.\+c}}
\subsubsection[{\+\_\+krpc\+\_\+call\+\_\+type\+\_\+e}]{\setlength{\rightskip}{0pt plus 5cm}enum {\bf \+\_\+krpc\+\_\+call\+\_\+type\+\_\+e}}\label{a00093_a4045ccaf4758dcf838a88a58c73e462b_a4045ccaf4758dcf838a88a58c73e462b}
\begin{Desc}
\item[枚举值]\par
\begin{description}
\index{krpc\+\_\+call\+\_\+type\+\_\+result@{krpc\+\_\+call\+\_\+type\+\_\+result}!rpc.\+c@{rpc.\+c}}\index{rpc.\+c@{rpc.\+c}!krpc\+\_\+call\+\_\+type\+\_\+result@{krpc\+\_\+call\+\_\+type\+\_\+result}}\item[{\em 
\hypertarget{a00093_a4045ccaf4758dcf838a88a58c73e462b_a4045ccaf4758dcf838a88a58c73e462ba831d2f31c2f7281a9b54c6816df54c61}{}krpc\+\_\+call\+\_\+type\+\_\+result\label{a00093_a4045ccaf4758dcf838a88a58c73e462b_a4045ccaf4758dcf838a88a58c73e462ba831d2f31c2f7281a9b54c6816df54c61}
}]\index{krpc\+\_\+call\+\_\+type\+\_\+call@{krpc\+\_\+call\+\_\+type\+\_\+call}!rpc.\+c@{rpc.\+c}}\index{rpc.\+c@{rpc.\+c}!krpc\+\_\+call\+\_\+type\+\_\+call@{krpc\+\_\+call\+\_\+type\+\_\+call}}\item[{\em 
\hypertarget{a00093_a4045ccaf4758dcf838a88a58c73e462b_a4045ccaf4758dcf838a88a58c73e462baff220c476768b4bf6b308fa257e12c4b}{}krpc\+\_\+call\+\_\+type\+\_\+call\label{a00093_a4045ccaf4758dcf838a88a58c73e462b_a4045ccaf4758dcf838a88a58c73e462baff220c476768b4bf6b308fa257e12c4b}
}]\end{description}
\end{Desc}


\subsection{函数说明}
\hypertarget{a00093_a8e2ea426099ea032432a9aeb24088cf0_a8e2ea426099ea032432a9aeb24088cf0}{}\index{rpc.\+c@{rpc.\+c}!\+\_\+krpc\+\_\+call@{\+\_\+krpc\+\_\+call}}
\index{\+\_\+krpc\+\_\+call@{\+\_\+krpc\+\_\+call}!rpc.\+c@{rpc.\+c}}
\subsubsection[{\+\_\+krpc\+\_\+call}]{\setlength{\rightskip}{0pt plus 5cm}int \+\_\+krpc\+\_\+call (
\begin{DoxyParamCaption}
\item[{{\bf krpc\+\_\+t} $\ast$}]{rpc, }
\item[{{\bf kstream\+\_\+t} $\ast$}]{stream, }
\item[{uint16\+\_\+t}]{rpcid, }
\item[{{\bf krpc\+\_\+object\+\_\+t} $\ast$}]{o}
\end{DoxyParamCaption}
)}\label{a00093_a8e2ea426099ea032432a9aeb24088cf0_a8e2ea426099ea032432a9aeb24088cf0}
\hypertarget{a00093_a81438b66394a3d6bf42c1971fefeb67c_a81438b66394a3d6bf42c1971fefeb67c}{}\index{rpc.\+c@{rpc.\+c}!\+\_\+krpc\+\_\+call\+\_\+encrypt@{\+\_\+krpc\+\_\+call\+\_\+encrypt}}
\index{\+\_\+krpc\+\_\+call\+\_\+encrypt@{\+\_\+krpc\+\_\+call\+\_\+encrypt}!rpc.\+c@{rpc.\+c}}
\subsubsection[{\+\_\+krpc\+\_\+call\+\_\+encrypt}]{\setlength{\rightskip}{0pt plus 5cm}int \+\_\+krpc\+\_\+call\+\_\+encrypt (
\begin{DoxyParamCaption}
\item[{{\bf krpc\+\_\+t} $\ast$}]{rpc, }
\item[{{\bf kstream\+\_\+t} $\ast$}]{stream, }
\item[{uint16\+\_\+t}]{rpcid, }
\item[{{\bf krpc\+\_\+object\+\_\+t} $\ast$}]{o}
\end{DoxyParamCaption}
)}\label{a00093_a81438b66394a3d6bf42c1971fefeb67c_a81438b66394a3d6bf42c1971fefeb67c}
\hypertarget{a00093_ae905b4f6864964a0080435a81748c3f1_ae905b4f6864964a0080435a81748c3f1}{}\index{rpc.\+c@{rpc.\+c}!\+\_\+krpc\+\_\+proc@{\+\_\+krpc\+\_\+proc}}
\index{\+\_\+krpc\+\_\+proc@{\+\_\+krpc\+\_\+proc}!rpc.\+c@{rpc.\+c}}
\subsubsection[{\+\_\+krpc\+\_\+proc}]{\setlength{\rightskip}{0pt plus 5cm}int \+\_\+krpc\+\_\+proc (
\begin{DoxyParamCaption}
\item[{{\bf krpc\+\_\+t} $\ast$}]{rpc, }
\item[{{\bf kstream\+\_\+t} $\ast$}]{stream}
\end{DoxyParamCaption}
)}\label{a00093_ae905b4f6864964a0080435a81748c3f1_ae905b4f6864964a0080435a81748c3f1}
\hypertarget{a00093_a87f076f27729e0d352ffd12173ab13ab_a87f076f27729e0d352ffd12173ab13ab}{}\index{rpc.\+c@{rpc.\+c}!\+\_\+krpc\+\_\+proc\+\_\+decrypt@{\+\_\+krpc\+\_\+proc\+\_\+decrypt}}
\index{\+\_\+krpc\+\_\+proc\+\_\+decrypt@{\+\_\+krpc\+\_\+proc\+\_\+decrypt}!rpc.\+c@{rpc.\+c}}
\subsubsection[{\+\_\+krpc\+\_\+proc\+\_\+decrypt}]{\setlength{\rightskip}{0pt plus 5cm}int \+\_\+krpc\+\_\+proc\+\_\+decrypt (
\begin{DoxyParamCaption}
\item[{{\bf krpc\+\_\+t} $\ast$}]{rpc, }
\item[{{\bf kstream\+\_\+t} $\ast$}]{stream}
\end{DoxyParamCaption}
)}\label{a00093_a87f076f27729e0d352ffd12173ab13ab_a87f076f27729e0d352ffd12173ab13ab}
\hypertarget{a00093_aa12a9874d2b0308994c3fa651cdbbd61_aa12a9874d2b0308994c3fa651cdbbd61}{}\index{rpc.\+c@{rpc.\+c}!krpc\+\_\+add\+\_\+cb@{krpc\+\_\+add\+\_\+cb}}
\index{krpc\+\_\+add\+\_\+cb@{krpc\+\_\+add\+\_\+cb}!rpc.\+c@{rpc.\+c}}
\subsubsection[{krpc\+\_\+add\+\_\+cb}]{\setlength{\rightskip}{0pt plus 5cm}int krpc\+\_\+add\+\_\+cb (
\begin{DoxyParamCaption}
\item[{{\bf krpc\+\_\+t} $\ast$}]{rpc, }
\item[{uint16\+\_\+t}]{rpcid, }
\item[{{\bf krpc\+\_\+cb\+\_\+t}}]{cb}
\end{DoxyParamCaption}
)}\label{a00093_aa12a9874d2b0308994c3fa651cdbbd61_aa12a9874d2b0308994c3fa651cdbbd61}


注册\+R\+P\+C调用回调函数 


\begin{DoxyParams}{参数}
{\em rpc} & krpc\+\_\+t实例 \\
\hline
{\em rpcid} & 回调\+I\+D \\
\hline
{\em cb} & 回调函数指针 \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{返回值}
{\em error\+\_\+ok} & 成功 \\
\hline
{\em 其他} & 失败 \\
\hline
\end{DoxyRetVals}
\hypertarget{a00093_a063313e66bd9a479b4d0a6295a5e665b_a063313e66bd9a479b4d0a6295a5e665b}{}\index{rpc.\+c@{rpc.\+c}!krpc\+\_\+call@{krpc\+\_\+call}}
\index{krpc\+\_\+call@{krpc\+\_\+call}!rpc.\+c@{rpc.\+c}}
\subsubsection[{krpc\+\_\+call}]{\setlength{\rightskip}{0pt plus 5cm}int krpc\+\_\+call (
\begin{DoxyParamCaption}
\item[{{\bf krpc\+\_\+t} $\ast$}]{rpc, }
\item[{{\bf kstream\+\_\+t} $\ast$}]{stream, }
\item[{uint16\+\_\+t}]{rpcid, }
\item[{{\bf krpc\+\_\+object\+\_\+t} $\ast$}]{o}
\end{DoxyParamCaption}
)}\label{a00093_a063313e66bd9a479b4d0a6295a5e665b_a063313e66bd9a479b4d0a6295a5e665b}


发起\+R\+P\+C调用 


\begin{DoxyParams}{参数}
{\em rpc} & krpc\+\_\+t实例 \\
\hline
{\em stream} & 数据流 \\
\hline
{\em rpcid} & 回调\+I\+D \\
\hline
{\em o} & 参数 \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{返回值}
{\em error\+\_\+ok} & 成功 \\
\hline
{\em 其他} & 失败 \\
\hline
\end{DoxyRetVals}
\hypertarget{a00093_a5d55f838d222f44965d99eac9a0381c1_a5d55f838d222f44965d99eac9a0381c1}{}\index{rpc.\+c@{rpc.\+c}!krpc\+\_\+create@{krpc\+\_\+create}}
\index{krpc\+\_\+create@{krpc\+\_\+create}!rpc.\+c@{rpc.\+c}}
\subsubsection[{krpc\+\_\+create}]{\setlength{\rightskip}{0pt plus 5cm}{\bf krpc\+\_\+t}$\ast$ krpc\+\_\+create (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}\label{a00093_a5d55f838d222f44965d99eac9a0381c1_a5d55f838d222f44965d99eac9a0381c1}


R\+P\+C框架提供了一套底层\+R\+P\+C序列化及反序列化的基础，开发者不应该直接调用这些\+A\+P\+I，应使用代码生成工具 提供的代码框架来进行\+R\+P\+C操作，生成的代码框架屏蔽了所有烦人的细节，使用起来也会比直接调用这些\+A\+P\+I更 方便. 

建立\+R\+P\+C \begin{DoxyReturn}{返回}
krpc\+\_\+t实例 
\end{DoxyReturn}
\hypertarget{a00093_a76529ccab5c6f0ada79cac791e299ef9_a76529ccab5c6f0ada79cac791e299ef9}{}\index{rpc.\+c@{rpc.\+c}!krpc\+\_\+del\+\_\+cb@{krpc\+\_\+del\+\_\+cb}}
\index{krpc\+\_\+del\+\_\+cb@{krpc\+\_\+del\+\_\+cb}!rpc.\+c@{rpc.\+c}}
\subsubsection[{krpc\+\_\+del\+\_\+cb}]{\setlength{\rightskip}{0pt plus 5cm}int krpc\+\_\+del\+\_\+cb (
\begin{DoxyParamCaption}
\item[{{\bf krpc\+\_\+t} $\ast$}]{rpc, }
\item[{uint16\+\_\+t}]{rpcid}
\end{DoxyParamCaption}
)}\label{a00093_a76529ccab5c6f0ada79cac791e299ef9_a76529ccab5c6f0ada79cac791e299ef9}


删除注册过的\+R\+P\+C调用回调函数 


\begin{DoxyParams}{参数}
{\em rpc} & krpc\+\_\+t实例 \\
\hline
{\em rpcid} & 回调\+I\+D \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{返回值}
{\em error\+\_\+ok} & 成功 \\
\hline
{\em 其他} & 失败 \\
\hline
\end{DoxyRetVals}
\hypertarget{a00093_ab07c8ccf1abc99b85f455a2f4280ac76_ab07c8ccf1abc99b85f455a2f4280ac76}{}\index{rpc.\+c@{rpc.\+c}!krpc\+\_\+destroy@{krpc\+\_\+destroy}}
\index{krpc\+\_\+destroy@{krpc\+\_\+destroy}!rpc.\+c@{rpc.\+c}}
\subsubsection[{krpc\+\_\+destroy}]{\setlength{\rightskip}{0pt plus 5cm}void krpc\+\_\+destroy (
\begin{DoxyParamCaption}
\item[{{\bf krpc\+\_\+t} $\ast$}]{rpc}
\end{DoxyParamCaption}
)}\label{a00093_ab07c8ccf1abc99b85f455a2f4280ac76_ab07c8ccf1abc99b85f455a2f4280ac76}


销毁\+R\+P\+C 


\begin{DoxyParams}{参数}
{\em rpc} & krpc\+\_\+t实例 \\
\hline
\end{DoxyParams}
\hypertarget{a00093_a7841a0b4c828efcb607a51bbdd9c9ab1_a7841a0b4c828efcb607a51bbdd9c9ab1}{}\index{rpc.\+c@{rpc.\+c}!krpc\+\_\+get\+\_\+cb@{krpc\+\_\+get\+\_\+cb}}
\index{krpc\+\_\+get\+\_\+cb@{krpc\+\_\+get\+\_\+cb}!rpc.\+c@{rpc.\+c}}
\subsubsection[{krpc\+\_\+get\+\_\+cb}]{\setlength{\rightskip}{0pt plus 5cm}{\bf krpc\+\_\+cb\+\_\+t} krpc\+\_\+get\+\_\+cb (
\begin{DoxyParamCaption}
\item[{{\bf krpc\+\_\+t} $\ast$}]{rpc, }
\item[{uint16\+\_\+t}]{rpcid}
\end{DoxyParamCaption}
)}\label{a00093_a7841a0b4c828efcb607a51bbdd9c9ab1_a7841a0b4c828efcb607a51bbdd9c9ab1}


取得注册过的\+R\+P\+C调用回调函数 


\begin{DoxyParams}{参数}
{\em rpc} & krpc\+\_\+t实例 \\
\hline
{\em rpcid} & 回调\+I\+D \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{返回}
回调函数指针 
\end{DoxyReturn}
\hypertarget{a00093_ac583f7d7c3e3ecb9954530e8d0f6f5f1_ac583f7d7c3e3ecb9954530e8d0f6f5f1}{}\index{rpc.\+c@{rpc.\+c}!krpc\+\_\+proc@{krpc\+\_\+proc}}
\index{krpc\+\_\+proc@{krpc\+\_\+proc}!rpc.\+c@{rpc.\+c}}
\subsubsection[{krpc\+\_\+proc}]{\setlength{\rightskip}{0pt plus 5cm}int krpc\+\_\+proc (
\begin{DoxyParamCaption}
\item[{{\bf krpc\+\_\+t} $\ast$}]{rpc, }
\item[{{\bf kstream\+\_\+t} $\ast$}]{stream}
\end{DoxyParamCaption}
)}\label{a00093_ac583f7d7c3e3ecb9954530e8d0f6f5f1_ac583f7d7c3e3ecb9954530e8d0f6f5f1}


处理\+R\+P\+C调用，从数据流反序列化\+R\+P\+C调用，并调用回调函数 


\begin{DoxyParams}{参数}
{\em rpc} & krpc\+\_\+t实例 \\
\hline
{\em stream} & 数据流 \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{返回值}
{\em error\+\_\+ok} & 成功 \\
\hline
{\em 其他} & 失败 \\
\hline
\end{DoxyRetVals}
\hypertarget{a00093_aa75ec66092e77639ca2cf2b5ad04c5db_aa75ec66092e77639ca2cf2b5ad04c5db}{}\index{rpc.\+c@{rpc.\+c}!krpc\+\_\+set\+\_\+decrypt\+\_\+cb@{krpc\+\_\+set\+\_\+decrypt\+\_\+cb}}
\index{krpc\+\_\+set\+\_\+decrypt\+\_\+cb@{krpc\+\_\+set\+\_\+decrypt\+\_\+cb}!rpc.\+c@{rpc.\+c}}
\subsubsection[{krpc\+\_\+set\+\_\+decrypt\+\_\+cb}]{\setlength{\rightskip}{0pt plus 5cm}int krpc\+\_\+set\+\_\+decrypt\+\_\+cb (
\begin{DoxyParamCaption}
\item[{{\bf krpc\+\_\+t} $\ast$}]{rpc, }
\item[{{\bf krpc\+\_\+decrypt\+\_\+t}}]{func}
\end{DoxyParamCaption}
)}\label{a00093_aa75ec66092e77639ca2cf2b5ad04c5db_aa75ec66092e77639ca2cf2b5ad04c5db}


设置签名解密回调 


\begin{DoxyParams}{参数}
{\em rpc} & krpc\+\_\+t实例 \\
\hline
{\em func} & 回调函数指针 \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{返回值}
{\em error\+\_\+ok} & 成功 \\
\hline
{\em 其他} & 失败 \\
\hline
\end{DoxyRetVals}
\hypertarget{a00093_a5317bb571cb4d94bc56b83989c1b10c2_a5317bb571cb4d94bc56b83989c1b10c2}{}\index{rpc.\+c@{rpc.\+c}!krpc\+\_\+set\+\_\+encrypt\+\_\+cb@{krpc\+\_\+set\+\_\+encrypt\+\_\+cb}}
\index{krpc\+\_\+set\+\_\+encrypt\+\_\+cb@{krpc\+\_\+set\+\_\+encrypt\+\_\+cb}!rpc.\+c@{rpc.\+c}}
\subsubsection[{krpc\+\_\+set\+\_\+encrypt\+\_\+cb}]{\setlength{\rightskip}{0pt plus 5cm}int krpc\+\_\+set\+\_\+encrypt\+\_\+cb (
\begin{DoxyParamCaption}
\item[{{\bf krpc\+\_\+t} $\ast$}]{rpc, }
\item[{{\bf krpc\+\_\+encrypt\+\_\+t}}]{func}
\end{DoxyParamCaption}
)}\label{a00093_a5317bb571cb4d94bc56b83989c1b10c2_a5317bb571cb4d94bc56b83989c1b10c2}


设置签名加密回调 


\begin{DoxyParams}{参数}
{\em rpc} & krpc\+\_\+t实例 \\
\hline
{\em func} & 回调函数指针 \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{返回值}
{\em error\+\_\+ok} & 成功 \\
\hline
{\em 其他} & 失败 \\
\hline
\end{DoxyRetVals}
